package com.ct.musicserver.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ct.musicserver.dao.dataobject.LoveMusicDO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface LoveMusicMapper extends BaseMapper<LoveMusicDO> {

    @Delete("delete from lovemusic where music_id = #{id} and user_id = #{userid}")
    void deleteByMusicIdAndUserId(@Param("id") Long id,@Param("userid") Long userid);

    @Select("select * from lovemusic where music_id = #{id} and user_id = #{userid}")
    LoveMusicDO selectByMusicIdAndUserId(@Param("id") Long id,@Param("userid") Long userid);

    @Select("select * from lovemusic where user_id = #{userid}")
    List<LoveMusicDO> selectByUserId(@Param("userid") Long userid);
}
